package Login;

import java.util.Random;

/**
 * 验证码处理
 * 随机数组 4个数 然后匹配输入的数组
 */
public class code {
    Random random = new Random();
    String sr = "0123456789";// 验证码可选字符

    public StringBuffer getCode() {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 4; i++) {
            int num = random.nextInt(10);
            sb.append(sr.charAt(num));
        }
//        System.out.println(sb);
        return sb;
    }
}
